﻿using System.Collections.Generic;
using System.ComponentModel;
using Newtonsoft.Json;

namespace Hourglass.Qrobot.Models
{
    public sealed class ReturnedDisscussInfo
    {
        /// <summary>
        /// 讨论组信息
        /// </summary>
        [JsonProperty("info")]
        public Info DisscussInfo { get; set; }

        /// <summary>
        /// 讨论组成员信息
        /// </summary>
        [JsonProperty("mem_info")]
        public List<MemberInfo> MemberInfos { get; set; }

        /// <summary>
        /// 讨论组成员在线状态
        /// </summary>
        [JsonProperty("mem_status")]
        public List<OnlineInfo> OnlineInfos { get; set; }

        #region Internal Class

        /// <summary>
        /// 成员信息
        /// </summary>
        public sealed class Member
        {
            /// <summary>
            /// 成员用户ID
            /// </summary>
            [JsonProperty("mem_uin")]
            public long MemberUin { get; set; }

            /// <summary>
            /// 未知ID
            /// </summary>
            [JsonProperty("ruin")]
            public long RUin { get; set; }
        }

        /// <summary>
        /// 成员信息
        /// </summary>
        public sealed class MemberInfo
        {
            /// <summary>
            /// 成员用户ID
            /// </summary>
            [JsonProperty("uin")]
            public long Uin { get; set; }

            /// <summary>
            /// 昵称
            /// </summary>
            [JsonProperty("nick")]
            public string NickName { get; set; }
        }

        /// <summary>
        /// 成员在线情况
        /// </summary>
        public sealed class OnlineInfo
        {
            /// <summary>
            /// 成员用户ID
            /// </summary>
            [JsonProperty("uin")]
            public long Uin { get; set; }

            /// <summary>
            /// 登录类型[PC/...]
            /// </summary>
            [DefaultValue(0)]
            [JsonProperty("client_type")]
            public int ClientType { get; set; }

            /// <summary>
            /// 在线状态[繁忙/...]
            /// </summary>
            [DefaultValue("offline")]
            [JsonProperty("status")]
            public string Status { get; set; }
        }

        /// <summary>
        /// 讨论组信息
        /// </summary>
        public sealed class Info
        {
            /// <summary>
            /// 讨论组ID
            /// </summary>
            [JsonProperty("did")]
            public long Id { get; set; }

            /// <summary>
            /// 讨论组名称
            /// </summary>
            [JsonProperty("discu_name")]
            public string Name { get; set; }

            /// <summary>
            /// 讨论组成员
            /// </summary>
            [JsonProperty("mem_list")]
            public List<Member> Members { get; set; }
        }

        #endregion Internal Class
    }
}
